package com.ssy.lingxi.workflow.model.constant;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author 万宁
 * @version 2.0.0
 * @date 2022-02-23
 */
public enum TaskNameEnum {
    TASK_NAME_1(1, "报名"),
    TASK_NAME_2(2, "采购订单归档"),
    TASK_NAME_3(3, "采购商换货收货"),
    TASK_NAME_4(4, "采购商确认售后完成"),
    TASK_NAME_5(5, "采购商确认退货回单"),
    TASK_NAME_6(6, "采购商确认退款结果"),
    TASK_NAME_7(7, "采购商提交换货申请单"),
    TASK_NAME_8(8, "采购商提交退货申请单"),
    TASK_NAME_9(9, "采购商退货发货"),
    TASK_NAME_10(10, "采购商新增换货入库单"),
    TASK_NAME_11(11, "采购商新增换货收货单"),
    TASK_NAME_12(12, "采购商新增退货发货单"),
    TASK_NAME_13(13, "采购商新增物流单"),
    TASK_NAME_14(14, "待比价"),
    TASK_NAME_15(15, "待确认授标结果"),
    TASK_NAME_16(16, "待审核（二级）"),
    TASK_NAME_17(17, "待审核授标结果(二级）"),
    TASK_NAME_18(18, "待审核授标结果(一级)"),
    TASK_NAME_19(19, "待审核（一级）"),
    TASK_NAME_20(20, "待提交审核"),
    TASK_NAME_21(21, "待提交审核投标"),
    TASK_NAME_22(22, "定标"),
    TASK_NAME_23(23, "订单发货"),
    TASK_NAME_24(24, "订单发货确认"),
    TASK_NAME_25(25, "订单归档"),
    TASK_NAME_26(26, "订单归档 采购商"),
    TASK_NAME_27(27, "订单归档 供应商"),
    TASK_NAME_28(28, "订单收货确认"),
    TASK_NAME_29(29, "订单支付"),
    TASK_NAME_30(30, "订单支付(1)"),
    TASK_NAME_31(31, "订单支付(2)"),
    TASK_NAME_32(32, "订单支付尾款"),
    TASK_NAME_33(33, "对账单请款"),
    TASK_NAME_34(34, "发布考评表"),
    TASK_NAME_35(35, "发送整改通知"),
    TASK_NAME_36(36, "供应商换货发货"),
    TASK_NAME_37(37, "供应商确认换货回单"),
    TASK_NAME_38(38, "供应商确认换货申请单"),
    TASK_NAME_39(39, "供应商确认退货申请单"),
    TASK_NAME_40(40, "供应商生产通知单收货"),
    TASK_NAME_41(41, "供应商提交生产通知单"),
    TASK_NAME_42(42, "供应商退货收货"),
    TASK_NAME_43(43, "供应商退款"),
    TASK_NAME_44(44, "供应商新增换货发货单"),
    TASK_NAME_45(45, "供应商新增加工入库单"),
    TASK_NAME_46(46, "供应商新增退货入库单"),
    TASK_NAME_47(47, "供应商新增退货收货单"),
    TASK_NAME_48(48, "供应商新增物流单"),
    TASK_NAME_49(49, "汇总需求计划"),
    TASK_NAME_50(50, "加工企业确认回单"),
    TASK_NAME_51(51, "加工企业确认生产通知单"),
    TASK_NAME_52(52, "加工企业生产通知单发货"),
    TASK_NAME_53(53, "加工企业新增加工发货单"),
    TASK_NAME_54(54, "加工企业新增物流单"),
    TASK_NAME_55(55, "甲方签订合同"),
    TASK_NAME_56(56, "进行整改"),
    TASK_NAME_57(57, "竞价"),
    TASK_NAME_58(58, "竞价报名"),
    TASK_NAME_59(59, "开标"),
    TASK_NAME_60(60, "考评打分"),
    TASK_NAME_61(61, "流程启动"),
    TASK_NAME_62(62, "平台审核退货申请单"),
    TASK_NAME_63(63, "平台审核招标"),
    TASK_NAME_64(64, "评标"),
    TASK_NAME_65(65, "签订合同"),
    TASK_NAME_66(66, "确认报价单"),
    TASK_NAME_67(67, "确认电子合同"),
    TASK_NAME_68(68, "确认定标"),
    TASK_NAME_69(69, "确认订单"),
    TASK_NAME_70(70, "确认对账单"),
    TASK_NAME_71(71, "确认换货申请单"),
    TASK_NAME_72(72, "确认回单"),
    TASK_NAME_73(73, "确认会员变更"),
    TASK_NAME_74(74, "确认会员审核结果"),
    TASK_NAME_75(75, "确认竞价结果"),
    TASK_NAME_76(76, "确认入库"),
    TASK_NAME_77(77, "确认审核结果"),
    TASK_NAME_78(78, "确认生产通知单"),
    TASK_NAME_79(79, "确认授标结果"),
    TASK_NAME_80(80, "确认授信申请单"),
    TASK_NAME_81(81, "确认退货申请单"),
    TASK_NAME_82(82, "确认维修申请单"),
    TASK_NAME_83(83, "确认尾款支付结果"),
    TASK_NAME_84(84, "确认物流单"),
    TASK_NAME_85(85, "确认整改结果"),
    TASK_NAME_86(86, "确认支付结果"),
    TASK_NAME_87(87, "确认支付结果(1)"),
    TASK_NAME_88(88, "确认支付结果(2)"),
    TASK_NAME_89(89, "入库分类"),
    TASK_NAME_90(90, "入库考察"),
    TASK_NAME_91(91, "上线平台营销活动"),
    TASK_NAME_92(92, "上线营销活动"),
    TASK_NAME_93(93, "审核报价单(二级)"),
    TASK_NAME_94(94, "审核报价单(一级)"),
    TASK_NAME_95(95, "审核报名"),
    TASK_NAME_96(96, "审核报名资料(二级)"),
    TASK_NAME_97(97, "审核报名资料(一级)"),
    TASK_NAME_98(98, "审核采购计划(二级)"),
    TASK_NAME_99(99, "审核采购计划（一级）"),
    TASK_NAME_100(100, "审核采购竞价单"),
    TASK_NAME_101(101, "审核采购竞价单(二级)"),
    TASK_NAME_102(102, "审核采购竞价单(一级)"),
    TASK_NAME_103(103, "审核采购收货单"),
    TASK_NAME_104(104, "审核定标(二级)"),
    TASK_NAME_105(105, "审核定标(一级)"),
    TASK_NAME_106(106, "审核订单二级"),
    TASK_NAME_107(107, "审核订单(二级)"),
    TASK_NAME_108(108, "审核订单(二级)(1)"),
    TASK_NAME_109(109, "审核订单(二级)(2)"),
    TASK_NAME_110(110, "审核订单一级"),
    TASK_NAME_111(111, "审核订单(一级)"),
    TASK_NAME_112(112, "审核订单(一级)(1)"),
    TASK_NAME_113(113, "审核订单(一级)(2)"),
    TASK_NAME_114(114, "审核合同(二级)"),
    TASK_NAME_115(115, "审核合同(一级)"),
    TASK_NAME_116(116, "审核换货申请单"),
    TASK_NAME_117(117, "审核会员变更"),
    TASK_NAME_118(118, "审核会员变更(二级)"),
    TASK_NAME_119(119, "审核会员变更(一级)"),
    TASK_NAME_120(120, "审核会员(二级)"),
    TASK_NAME_121(121, "审核会员(一级)"),
    TASK_NAME_122(122, "审核竞价报名"),
    TASK_NAME_123(123, "审核竞价结果(二级)"),
    TASK_NAME_124(124, "审核竞价结果(一级)"),
    TASK_NAME_125(125, "审核考评结果(二级)"),
    TASK_NAME_126(126, "审核考评结果(一级)"),
    TASK_NAME_127(127, "审核平台营销活动(二级)"),
    TASK_NAME_128(128, "审核平台营销活动(一级)"),
    TASK_NAME_129(129, "审核平台优惠劵(二级)"),
    TASK_NAME_130(130, "审核平台优惠劵(一级)"),
    TASK_NAME_131(131, "审核请购单二级"),
    TASK_NAME_132(132, "审核请购单一级"),
    TASK_NAME_133(133, "审核请款单(二级)"),
    TASK_NAME_134(134, "审核请款单(一级)"),
    TASK_NAME_135(135, "审核入库"),
    TASK_NAME_136(136, "审核入库(二级)"),
    TASK_NAME_137(137, "审核入库(一级)"),
    TASK_NAME_138(138, "审核入库资质"),
    TASK_NAME_139(139, "审核商家营销活动(二级)"),
    TASK_NAME_140(140, "审核商家营销活动(一级)"),
    TASK_NAME_141(141, "审核商家优惠劵(二级)"),
    TASK_NAME_142(142, "审核商家优惠劵(一级)"),
    TASK_NAME_143(143, "审核生产通知单(二级)"),
    TASK_NAME_144(144, "审核生产通知单(一级)"),
    TASK_NAME_145(145, "审核授信申请单(二)"),
    TASK_NAME_146(146, "审核授信申请单(三)"),
    TASK_NAME_147(147, "审核授信申请单(一)"),
    TASK_NAME_148(148, "审核投标(二级)"),
    TASK_NAME_149(149, "审核投标(一级)"),
    TASK_NAME_150(150, "审核退货二"),
    TASK_NAME_151(151, "审核退货一"),
    TASK_NAME_152(152, "审核维修申请单(二级)"),
    TASK_NAME_153(153, "审核维修申请单(一级)"),
    TASK_NAME_154(154, "审核销售发货单"),
    TASK_NAME_155(155, "审核需求单(二级)"),
    TASK_NAME_156(156, "审核需求单(一级)"),
    TASK_NAME_157(157, "审核需求计划(二级)"),
    TASK_NAME_158(158, "审核需求计划（一级）"),
    TASK_NAME_159(159, "审核询价单(二级)"),
    TASK_NAME_160(160, "审核询价单(一级)"),
    TASK_NAME_161(161, "审核营销活动"),
    TASK_NAME_162(162, "审核营销活动(二级)"),
    TASK_NAME_163(163, "审核营销活动(一级)"),
    TASK_NAME_164(164, "审核招标(二级)"),
    TASK_NAME_165(165, "审核招标(一级)"),
    TASK_NAME_166(166, "审核资料入库"),
    TASK_NAME_167(167, "手工发货"),
    TASK_NAME_168(168, "手工收货"),
    TASK_NAME_169(169, "提交报价单"),
    TASK_NAME_170(170, "提交报名资料"),
    TASK_NAME_171(171, "提交采购竞价单"),
    TASK_NAME_172(172, "提交采购需求单"),
    TASK_NAME_173(173, "提交定标"),
    TASK_NAME_174(174, "提交订单"),
    TASK_NAME_175(175, "提交对账单"),
    TASK_NAME_176(176, "提交汇总考评结果"),
    TASK_NAME_177(177, "提交平台优惠劵"),
    TASK_NAME_178(178, "提交请购单"),
    TASK_NAME_179(179, "提交请款单"),
    TASK_NAME_180(180, "提交商家营销活动"),
    TASK_NAME_181(181, "提交商家优惠劵"),
    TASK_NAME_182(182, "提交审核报价单"),
    TASK_NAME_183(183, "提交审核采购计划"),
    TASK_NAME_184(184, "提交审核订单"),
    TASK_NAME_185(185, "提交审核合同"),
    TASK_NAME_186(186, "提交审核会员"),
    TASK_NAME_187(187, "提交审核竞价结果"),
    TASK_NAME_188(188, "提交审核平台营销活动"),
    TASK_NAME_189(189, "提交审核商家营销活动"),
    TASK_NAME_190(190, "提交审核生产通知单"),
    TASK_NAME_191(191, "提交审核授信申请单"),
    TASK_NAME_192(192, "提交审核维修申请单"),
    TASK_NAME_193(193, "提交生产通知单"),
    TASK_NAME_194(194, "提交投标"),
    TASK_NAME_195(195, "提交物流单"),
    TASK_NAME_196(196, "提交需求单"),
    TASK_NAME_197(197, "提交需求计划"),
    TASK_NAME_198(198, "提交询价单"),
    TASK_NAME_199(199, "提交营销活动"),
    TASK_NAME_200(200, "提交招标"),
    TASK_NAME_201(201, "提交资格预审"),
    TASK_NAME_202(202, "填写报名资料"),
    TASK_NAME_203(203, "通报考评结果"),
    TASK_NAME_204(204, "投标"),
    TASK_NAME_205(205, "完成招标"),
    TASK_NAME_206(206, "新增报价单"),
    TASK_NAME_207(207, "新增采购竞价单"),
    TASK_NAME_208(208, "新增采购入库单"),
    TASK_NAME_209(209, "新增采购收货单"),
    TASK_NAME_210(210, "新增订单"),
    TASK_NAME_211(211, "新增合同"),
    TASK_NAME_212(212, "新增平台营销活动"),
    TASK_NAME_213(213, "新增平台优惠劵"),
    TASK_NAME_214(214, "新增请购单"),
    TASK_NAME_215(215, "新增请款单"),
    TASK_NAME_216(216, "新增商家优惠劵"),
    TASK_NAME_217(217, "新增投标"),
    TASK_NAME_218(218, "新增物流单"),
    TASK_NAME_219(219, "新增销售发货单"),
    TASK_NAME_220(220, "新增需求单"),
    TASK_NAME_221(221, "新增需求计划"),
    TASK_NAME_222(222, "新增询价单"),
    TASK_NAME_223(223, "新增营销活动"),
    TASK_NAME_224(224, "新增招标"),
    TASK_NAME_225(225, "虚拟任务"),
    TASK_NAME_226(226, "乙方签订合同"),
    TASK_NAME_227(227, "招标报名"),
    TASK_NAME_228(228, "支付订单"),
    TASK_NAME_229(229, "执行计划"),
    TASK_NAME_230(230, "中标公示"),
    TASK_NAME_231(231, "资格预审"),
    TASK_NAME_232(232, "提交物料"),
    TASK_NAME_233(233, "一级审批"),
    TASK_NAME_234(234, "一级审核"),
    TASK_NAME_235(235, "二级审核"),
    TASK_NAME_236(236, "一级审核（启用）"),
    TASK_NAME_237(237, "二级审核（启用）"),
    ;

    TaskNameEnum(Integer code, String processTaskName) {
        this.code = code;
        this.processTaskName = processTaskName;
    }

    private Integer code;
    private String processTaskName;

    public Integer getCode() {
        return code;
    }

    public String getProcessTaskName() {
        return processTaskName;
    }

    /**
     * 根据流程图中的任务名称，查询code，即messages.properties中的序号
     * @param taskName 任务步骤名称
     * @return 序号
     */
    public static Integer findCodeByName(String taskName) {
        return Objects.isNull(taskName) ? 0 : Arrays.stream(TaskNameEnum.values()).filter(e -> e.getProcessTaskName().equals(taskName)).map(TaskNameEnum::getCode).findFirst().orElse(0);
    }
}
